diff options
| author | ShyamsundarR <srangana@redhat.com> | 2018-03-09 16:51:57 -0500 | 
|---|---|---|
| committer | Raghavendra G <rgowdapp@redhat.com> | 2018-03-10 18:08:53 +0000 | 
| commit | b966c7790e35de353ae09ee48d4e2f55e0117f7e (patch) | |
| tree | 57ef3565e39576644c7b713930f65c5d6240d75c /libglusterfs | |
| parent | 157e55fe43ba13f04452aa11f42200b279fb4f7a (diff) | |
protocol: Added iatt conversion to older format
Added iatt conversion to an older format, when dealing with
older RPC versions. This enables iatt structure conformance
when dealing with older clients.
This helps fix rolling upgrade from 3.x versions to 4.0 version
of gluster by sending the right iatt in the dictionary when DHT
requests the same.
Change-Id: Ieaf925f81f8c7798a8fba1e90a59fa9dec82856c
BUG: 1544699
Signed-off-by: ShyamsundarR <srangana@redhat.com>
Diffstat (limited to 'libglusterfs')
| -rw-r--r-- | libglusterfs/src/iatt.h | 47 | 
1 files changed, 47 insertions, 0 deletions
diff --git a/libglusterfs/src/iatt.h b/libglusterfs/src/iatt.h index 8cb2b4a5b27..68a81fa9cd0 100644 --- a/libglusterfs/src/iatt.h +++ b/libglusterfs/src/iatt.h @@ -72,6 +72,27 @@ struct iatt {          ia_prot_t    ia_prot;       /* protection */  }; +struct old_iatt { +        uint64_t     ia_ino;        /* inode number */ +        uuid_t       ia_gfid; +        uint64_t     ia_dev;        /* backing device ID */ +        ia_type_t    ia_type;       /* type of file */ +        ia_prot_t    ia_prot;       /* protection */ +        uint32_t     ia_nlink;      /* Link count */ +        uint32_t     ia_uid;        /* user ID of owner */ +        uint32_t     ia_gid;        /* group ID of owner */ +        uint64_t     ia_rdev;       /* device ID (if special file) */ +        uint64_t     ia_size;       /* file size in bytes */ +        uint32_t     ia_blksize;    /* blocksize for filesystem I/O */ +        uint64_t     ia_blocks;     /* number of 512B blocks allocated */ +        uint32_t     ia_atime;      /* last access time */ +        uint32_t     ia_atime_nsec; +        uint32_t     ia_mtime;      /* last modification time */ +        uint32_t     ia_mtime_nsec; +        uint32_t     ia_ctime;      /* last status change time */ +        uint32_t     ia_ctime_nsec; +}; +  /* 64-bit mask for valid members in struct iatt. */  #define IATT_TYPE             0x0000000000000001U  #define IATT_MODE             0x0000000000000002U @@ -376,6 +397,32 @@ iatt_to_stat (struct iatt *iatt, struct stat *stat)          return 0;  } +static inline void +oldiatt_from_iatt (struct old_iatt *o_iatt, struct iatt *c_iatt) +{ +        o_iatt->ia_dev        = c_iatt->ia_dev; +        o_iatt->ia_ino        = c_iatt->ia_ino; +        o_iatt->ia_type       = c_iatt->ia_type; +        o_iatt->ia_prot       = c_iatt->ia_prot; +        o_iatt->ia_nlink      = c_iatt->ia_nlink; +        o_iatt->ia_uid        = c_iatt->ia_uid; +        o_iatt->ia_gid        = c_iatt->ia_gid; +        o_iatt->ia_rdev       = c_iatt->ia_rdev; +        o_iatt->ia_size       = c_iatt->ia_size; +        o_iatt->ia_blksize    = c_iatt->ia_blksize; +        o_iatt->ia_blocks     = c_iatt->ia_blocks; +        o_iatt->ia_atime      = c_iatt->ia_atime; +        o_iatt->ia_atime_nsec = c_iatt->ia_atime_nsec; +        o_iatt->ia_mtime      = c_iatt->ia_mtime; +        o_iatt->ia_mtime_nsec = c_iatt->ia_mtime_nsec; +        o_iatt->ia_ctime      = c_iatt->ia_ctime; +        o_iatt->ia_ctime_nsec = c_iatt->ia_ctime_nsec; + +        gf_uuid_copy (o_iatt->ia_gfid, c_iatt->ia_gfid); + +        return; +} +  static inline int  is_same_mode (ia_prot_t prot1, ia_prot_t prot2)  {  | 
