Browse Source

Ticket #4022: fix compile failure on AIX 7.2.

Rename MC VFS flags to avoid name conflicts with system-wide VFS flags
on some OSes (such as AIX).

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Andrew Borodin 5 years ago
parent
commit
68d9961977
10 changed files with 36 additions and 35 deletions
  1. 1 1
      lib/utilunix.c
  2. 12 12
      lib/vfs/direntry.c
  3. 1 1
      lib/vfs/gc.c
  4. 4 3
      lib/vfs/path.c
  5. 7 7
      lib/vfs/vfs.c
  6. 6 6
      lib/vfs/vfs.h
  7. 1 1
      src/filemanager/file.c
  8. 1 1
      src/vfs/cpio/cpio.c
  9. 2 2
      src/vfs/extfs/extfs.c
  10. 1 1
      src/vfs/fish/fish.c

+ 1 - 1
lib/utilunix.c

@@ -956,7 +956,7 @@ custom_canonicalize_pathname (char *path, CANON_PATH_FLAGS flags)
                     vclass = vfs_prefix_to_class (vfs_prefix);
                     *(s - url_delim_len) = *VFS_PATH_URL_DELIMITER;
 
-                    if (vclass != NULL && (vclass->flags & VFS_REMOTE) != 0)
+                    if (vclass != NULL && (vclass->flags & VFSF_REMOTE) != 0)
                     {
                         s = vfs_prefix;
                         continue;

+ 12 - 12
lib/vfs/direntry.c

@@ -672,7 +672,7 @@ vfs_s_close (void *fh)
         sub->linear_close (me, fh);
     if (sub->fh_close != NULL)
         res = sub->fh_close (me, fh);
-    if ((me->flags & VFS_USETMP) != 0 && file->changed && sub->file_store != NULL)
+    if ((me->flags & VFSF_USETMP) != 0 && file->changed && sub->file_store != NULL)
     {
         char *s;
 
@@ -764,7 +764,7 @@ vfs_s_getlocalcopy (const vfs_path_t * vpath)
         const struct vfs_class *me;
 
         me = vfs_path_get_by_index (vpath, -1)->class;
-        if ((me->flags & VFS_USETMP) != 0 && fh->ino != NULL)
+        if ((me->flags & VFSF_USETMP) != 0 && fh->ino != NULL)
             local = vfs_path_from_str_flags (fh->ino->localname, VPF_NO_CANON);
 
         vfs_s_close (fh);
@@ -932,7 +932,7 @@ vfs_s_free_inode (struct vfs_class *me, struct vfs_s_inode *ino)
 
     CALL (free_inode) (me, ino);
     g_free (ino->linkname);
-    if ((me->flags & VFS_USETMP) != 0 && ino->localname != NULL)
+    if ((me->flags & VFSF_USETMP) != 0 && ino->localname != NULL)
     {
         unlink (ino->localname);
         g_free (ino->localname);
@@ -1095,7 +1095,7 @@ vfs_s_find_inode (struct vfs_class *me, const struct vfs_s_super *super,
 {
     struct vfs_s_entry *ent;
 
-    if (((me->flags & VFS_REMOTE) == 0) && (*path == '\0'))
+    if (((me->flags & VFSF_REMOTE) == 0) && (*path == '\0'))
         return super->root;
 
     ent = VFS_SUBCLASS (me)->find_entry (me, super->root, path, follow, flags);
@@ -1247,7 +1247,7 @@ vfs_s_fullpath (struct vfs_class *me, struct vfs_s_inode *ino)
     if (ino->ent == NULL)
         ERRNOR (EAGAIN, NULL);
 
-    if ((me->flags & VFS_USETMP) == 0)
+    if ((me->flags & VFSF_USETMP) == 0)
     {
         /* archives */
         char *path;
@@ -1339,7 +1339,7 @@ vfs_s_open (const vfs_path_t * vpath, int flags, mode_t mode)
         ent = vfs_s_generate_entry (path_element->class, name, dir, 0755);
         ino = ent->ino;
         vfs_s_insert_entry (path_element->class, dir, ent);
-        if ((VFS_CLASS (s)->flags & VFS_USETMP) != 0)
+        if ((VFS_CLASS (s)->flags & VFSF_USETMP) != 0)
         {
             int tmp_handle;
             vfs_path_t *tmp_vpath;
@@ -1386,7 +1386,7 @@ vfs_s_open (const vfs_path_t * vpath, int flags, mode_t mode)
         }
     }
 
-    if ((VFS_CLASS (s)->flags & VFS_USETMP) != 0 && fh->ino->localname != NULL)
+    if ((VFS_CLASS (s)->flags & VFSF_USETMP) != 0 && fh->ino->localname != NULL)
     {
         fh->handle = open (fh->ino->localname, NO_LINEAR (flags), mode);
         if (fh->handle == -1)
@@ -1444,7 +1444,7 @@ vfs_s_retrieve_file (struct vfs_class *me, struct vfs_s_inode *ino)
     vfs_path_t *tmp_vpath;
     struct vfs_s_subclass *s = VFS_SUBCLASS (me);
 
-    if ((me->flags & VFS_USETMP) == 0)
+    if ((me->flags & VFSF_USETMP) == 0)
         return (-1);
 
     handle = vfs_mkstemps (&tmp_vpath, me->name, ino->ent->name);
@@ -1523,7 +1523,7 @@ vfs_init_class (struct vfs_class *vclass, const char *name, vfs_flags_t flags, c
     vclass->open = vfs_s_open;
     vclass->close = vfs_s_close;
     vclass->read = vfs_s_read;
-    if ((vclass->flags & VFS_READONLY) == 0)
+    if ((vclass->flags & VFSF_READONLY) == 0)
         vclass->write = vfs_s_write;
     vclass->opendir = vfs_s_opendir;
     vclass->readdir = vfs_s_readdir;
@@ -1539,7 +1539,7 @@ vfs_init_class (struct vfs_class *vclass, const char *name, vfs_flags_t flags, c
     vclass->nothingisopen = vfs_s_nothingisopen;
     vclass->free = vfs_s_free;
     vclass->setctl = vfs_s_setctl;
-    if ((vclass->flags & VFS_USETMP) != 0)
+    if ((vclass->flags & VFSF_USETMP) != 0)
     {
         vclass->getlocalcopy = vfs_s_getlocalcopy;
         vclass->ungetlocalcopy = vfs_s_ungetlocalcopy;
@@ -1562,9 +1562,9 @@ vfs_init_subclass (struct vfs_s_subclass *sub, const char *name, vfs_flags_t fla
     start = (char *) sub + sizeof (struct vfs_class);
     memset (start, 0, len);
 
-    if ((vclass->flags & VFS_USETMP) != 0)
+    if ((vclass->flags & VFSF_USETMP) != 0)
         sub->find_entry = vfs_s_find_entry_linear;
-    else if ((vclass->flags & VFS_REMOTE) != 0)
+    else if ((vclass->flags & VFSF_REMOTE) != 0)
         sub->find_entry = vfs_s_find_entry_linear;
     else
         sub->find_entry = vfs_s_find_entry_tree;

+ 1 - 1
lib/vfs/gc.c

@@ -135,7 +135,7 @@ vfs_stamp_compare (gconstpointer a, gconstpointer b)
 static void
 vfs_addstamp (struct vfs_class *v, vfsid id)
 {
-    if ((v->flags & VFS_LOCAL) == 0 && id != NULL && !vfs_stamp (v, id))
+    if ((v->flags & VFSF_LOCAL) == 0 && id != NULL && !vfs_stamp (v, id))
     {
         struct vfs_stamping *stamp;
 

+ 4 - 3
lib/vfs/path.c

@@ -461,7 +461,7 @@ vfs_path_from_str_uri_parser (char *path)
 
         url_delimiter += strlen (VFS_PATH_URL_DELIMITER);
 
-        if (element->class != NULL && (element->class->flags & VFS_REMOTE) != 0)
+        if (element->class != NULL && (element->class->flags & VFSF_REMOTE) != 0)
         {
             char *slash_pointer;
 
@@ -530,7 +530,7 @@ static void
 vfs_path_tokens_add_class_info (const vfs_path_element_t * element, GString * ret_tokens,
                                 GString * element_tokens)
 {
-    if (((element->class->flags & VFS_LOCAL) == 0 || ret_tokens->len > 0)
+    if (((element->class->flags & VFSF_LOCAL) == 0 || ret_tokens->len > 0)
         && element_tokens->len > 0)
     {
         char *url_str;
@@ -595,7 +595,8 @@ vfs_path_strip_home (const char *dir)
 
 #define vfs_append_from_path(appendfrom, is_relative) \
 { \
-    if ((flags & VPF_STRIP_HOME) && element_index == 0 && (element->class->flags & VFS_LOCAL) != 0) \
+    if ((flags & VPF_STRIP_HOME) && element_index == 0 && \
+        (element->class->flags & VFSF_LOCAL) != 0) \
     { \
         char *stripped_home_str; \
         stripped_home_str = vfs_path_strip_home (appendfrom); \

+ 7 - 7
lib/vfs/vfs.c

@@ -438,7 +438,7 @@ vfs_set_raw_current_dir (const vfs_path_t * vpath)
 gboolean
 vfs_current_is_local (void)
 {
-    return (current_vfs->flags & VFS_LOCAL) != 0;
+    return (current_vfs->flags & VFSF_LOCAL) != 0;
 }
 
 /* --------------------------------------------------------------------------------------------- */
@@ -451,7 +451,7 @@ vfs_file_class_flags (const vfs_path_t * vpath)
 
     path_element = vfs_path_get_by_index (vpath, -1);
     if (!vfs_path_element_valid (path_element))
-        return VFS_UNKNOWN;
+        return VFSF_UNKNOWN;
 
     return path_element->class->flags;
 }
@@ -546,7 +546,7 @@ vfs_fill_names (fill_names_f func)
 gboolean
 vfs_file_is_local (const vfs_path_t * vpath)
 {
-    return (vfs_file_class_flags (vpath) & VFS_LOCAL) != 0;
+    return (vfs_file_class_flags (vpath) & VFSF_LOCAL) != 0;
 }
 
 /* --------------------------------------------------------------------------------------------- */
@@ -597,7 +597,7 @@ vfs_setup_cwd (void)
 
     path_element = vfs_path_get_by_index (vfs_get_raw_current_dir (), -1);
 
-    if ((path_element->class->flags & VFS_LOCAL) != 0)
+    if ((path_element->class->flags & VFSF_LOCAL) != 0)
     {
         current_dir = g_get_current_dir ();
         tmp_vpath = vfs_path_from_str (current_dir);
@@ -662,7 +662,7 @@ vfs_preallocate (int dest_vfs_fd, off_t src_fsize, off_t dest_fsize)
         return 0;
 
     dest_class = vfs_class_find_by_handle (dest_vfs_fd, &dest_fd);
-    if ((dest_class->flags & VFS_LOCAL) == 0 || dest_fd == NULL)
+    if ((dest_class->flags & VFSF_LOCAL) == 0 || dest_fd == NULL)
         return 0;
 
     return posix_fallocate (*(int *) dest_fd, dest_fsize, src_fsize - dest_fsize);
@@ -682,7 +682,7 @@ vfs_clone_file (int dest_vfs_fd, int src_vfs_fd)
     struct vfs_class *src_class;
 
     dest_class = vfs_class_find_by_handle (dest_vfs_fd, &dest_fd);
-    if ((dest_class->flags & VFS_LOCAL) == 0)
+    if ((dest_class->flags & VFSF_LOCAL) == 0)
     {
         errno = EOPNOTSUPP;
         return (-1);
@@ -694,7 +694,7 @@ vfs_clone_file (int dest_vfs_fd, int src_vfs_fd)
     }
 
     src_class = vfs_class_find_by_handle (src_vfs_fd, &src_fd);
-    if ((src_class->flags & VFS_LOCAL) == 0)
+    if ((src_class->flags & VFSF_LOCAL) == 0)
     {
         errno = EOPNOTSUPP;
         return (-1);

+ 6 - 6
lib/vfs/vfs.h

@@ -111,13 +111,13 @@ typedef struct utimbuf mc_timesbuf_t;
 
 typedef enum
 {
-    VFS_UNKNOWN = 0,
-    VFS_LOCAL = 1 << 0,         /* Class is local (not virtual) filesystem */
-    VFS_NOLINKS = 1 << 1,       /* Hard links not supported */
+    VFSF_UNKNOWN = 0,
+    VFSF_LOCAL = 1 << 0,        /* Class is local (not virtual) filesystem */
+    VFSF_NOLINKS = 1 << 1,      /* Hard links not supported */
 
-    VFS_REMOTE = 1 << 2,
-    VFS_READONLY = 1 << 3,
-    VFS_USETMP = 1 << 4
+    VFSF_REMOTE = 1 << 2,
+    VFSF_READONLY = 1 << 3,
+    VFSF_USETMP = 1 << 4
 } vfs_flags_t;
 
 /* Operations for mc_ctl - on open file */

+ 1 - 1
src/filemanager/file.c

@@ -353,7 +353,7 @@ check_hardlinks (const vfs_path_t * src_vpath, const struct stat *src_stat,
 
     if (src_stat->st_nlink < 2)
         return HARDLINK_NOTLINK;
-    if ((vfs_file_class_flags (src_vpath) & VFS_NOLINKS) != 0)
+    if ((vfs_file_class_flags (src_vpath) & VFSF_NOLINKS) != 0)
         return HARDLINK_UNSUPPORTED;
 
     lnk = (struct link *) is_in_linklist (linklist, src_vpath, src_stat);

+ 1 - 1
src/vfs/cpio/cpio.c

@@ -890,7 +890,7 @@ void
 vfs_init_cpiofs (void)
 {
     /* FIXME: cpiofs used own temp files */
-    vfs_init_subclass (&cpio_subclass, "cpiofs", VFS_READONLY, "ucpio");
+    vfs_init_subclass (&cpio_subclass, "cpiofs", VFSF_READONLY, "ucpio");
     vfs_cpiofs_ops->read = cpio_read;
     vfs_cpiofs_ops->setctl = NULL;
     cpio_subclass.archive_check = cpio_super_check;

+ 2 - 2
src/vfs/extfs/extfs.c

@@ -328,7 +328,7 @@ extfs_fill_names (struct vfs_class *me, fill_names_f func)
 
 /* --------------------------------------------------------------------------------------------- */
 
-/* Create this function because VFS_USETMP flag is not used in extfs */
+/* Create this function because VFSF_USETMP flag is not used in extfs */
 static void
 extfs_free_inode (struct vfs_class *me, struct vfs_s_inode *ino)
 {
@@ -1559,7 +1559,7 @@ extfs_setctl (const vfs_path_t * vpath, int ctlop, void *arg)
 void
 vfs_init_extfs (void)
 {
-    vfs_init_subclass (&extfs_subclass, "extfs", VFS_UNKNOWN, NULL);
+    vfs_init_subclass (&extfs_subclass, "extfs", VFSF_UNKNOWN, NULL);
     vfs_extfs_ops->init = extfs_init;
     vfs_extfs_ops->done = extfs_done;
     vfs_extfs_ops->fill_names = extfs_fill_names;

+ 1 - 1
src/vfs/fish/fish.c

@@ -1750,7 +1750,7 @@ vfs_init_fish (void)
 {
     tcp_init ();
 
-    vfs_init_subclass (&fish_subclass, "fish", VFS_REMOTE | VFS_USETMP, "sh");
+    vfs_init_subclass (&fish_subclass, "fish", VFSF_REMOTE | VFSF_USETMP, "sh");
     vfs_fish_ops->fill_names = fish_fill_names;
     vfs_fish_ops->stat = fish_stat;
     vfs_fish_ops->lstat = fish_lstat;

Some files were not shown because too many files changed in this diff