Mon Nov 19 00:36:21 2012 UTC ()
- Add e2di_version, e2di_nblock_high, e2di_facl_high fields to ext2fs_dinode.

- Update i_e2fs_ aliases to match.

- ext2fs_bswap support for these ext2fs_dinode fields.

(e2di_version and e2di_facl_high replace previously reserved fields.
e2di_nblock_high was formerly e2di_nfrag and e2di_fsize, however these
are currently defined in e2fsprogs as only being relevant for HURD.)


(jakllsch)
diff -r1.17 -r1.18 src/sys/ufs/ext2fs/ext2fs_bswap.c
diff -r1.23 -r1.24 src/sys/ufs/ext2fs/ext2fs_dinode.h
diff -r1.63 -r1.64 src/sys/ufs/ufs/inode.h

cvs diff -r1.17 -r1.18 src/sys/ufs/ext2fs/ext2fs_bswap.c (expand / switch to unified diff)

--- src/sys/ufs/ext2fs/ext2fs_bswap.c 2012/11/18 17:59:56 1.17
+++ src/sys/ufs/ext2fs/ext2fs_bswap.c 2012/11/19 00:36:21 1.18
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ext2fs_bswap.c,v 1.17 2012/11/18 17:59:56 jakllsch Exp $ */ 1/* $NetBSD: ext2fs_bswap.c,v 1.18 2012/11/19 00:36:21 jakllsch Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1997 Manuel Bouyer. 4 * Copyright (c) 1997 Manuel Bouyer.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright 11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * 14 *
@@ -16,27 +16,27 @@ @@ -16,27 +16,27 @@
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 * 25 *
26 */ 26 */
27 27
28#include <sys/cdefs.h> 28#include <sys/cdefs.h>
29__KERNEL_RCSID(0, "$NetBSD: ext2fs_bswap.c,v 1.17 2012/11/18 17:59:56 jakllsch Exp $"); 29__KERNEL_RCSID(0, "$NetBSD: ext2fs_bswap.c,v 1.18 2012/11/19 00:36:21 jakllsch Exp $");
30 30
31#include <sys/types.h> 31#include <sys/types.h>
32#include <ufs/ext2fs/ext2fs.h> 32#include <ufs/ext2fs/ext2fs.h>
33#include <ufs/ext2fs/ext2fs_dinode.h> 33#include <ufs/ext2fs/ext2fs_dinode.h>
34 34
35#if defined(_KERNEL) 35#if defined(_KERNEL)
36#include <sys/systm.h> 36#include <sys/systm.h>
37#else 37#else
38#include <string.h> 38#include <string.h>
39#endif 39#endif
40 40
41/* These functions are only needed if native byte order is not little endian */ 41/* These functions are only needed if native byte order is not little endian */
42#if BYTE_ORDER == BIG_ENDIAN 42#if BYTE_ORDER == BIG_ENDIAN
@@ -99,23 +99,26 @@ void e2fs_i_bswap(struct ext2fs_dinode * @@ -99,23 +99,26 @@ void e2fs_i_bswap(struct ext2fs_dinode *
99{ 99{
100 100
101 new->e2di_mode = bswap16(old->e2di_mode); 101 new->e2di_mode = bswap16(old->e2di_mode);
102 new->e2di_uid = bswap16(old->e2di_uid); 102 new->e2di_uid = bswap16(old->e2di_uid);
103 new->e2di_gid = bswap16(old->e2di_gid); 103 new->e2di_gid = bswap16(old->e2di_gid);
104 new->e2di_nlink = bswap16(old->e2di_nlink); 104 new->e2di_nlink = bswap16(old->e2di_nlink);
105 new->e2di_size = bswap32(old->e2di_size); 105 new->e2di_size = bswap32(old->e2di_size);
106 new->e2di_atime = bswap32(old->e2di_atime); 106 new->e2di_atime = bswap32(old->e2di_atime);
107 new->e2di_ctime = bswap32(old->e2di_ctime); 107 new->e2di_ctime = bswap32(old->e2di_ctime);
108 new->e2di_mtime = bswap32(old->e2di_mtime); 108 new->e2di_mtime = bswap32(old->e2di_mtime);
109 new->e2di_dtime = bswap32(old->e2di_dtime); 109 new->e2di_dtime = bswap32(old->e2di_dtime);
110 new->e2di_nblock = bswap32(old->e2di_nblock); 110 new->e2di_nblock = bswap32(old->e2di_nblock);
111 new->e2di_flags = bswap32(old->e2di_flags); 111 new->e2di_flags = bswap32(old->e2di_flags);
 112 new->e2di_version = bswap32(old->e2di_version);
112 new->e2di_gen = bswap32(old->e2di_gen); 113 new->e2di_gen = bswap32(old->e2di_gen);
113 new->e2di_facl = bswap32(old->e2di_facl); 114 new->e2di_facl = bswap32(old->e2di_facl);
114 new->e2di_dacl = bswap32(old->e2di_dacl); 115 new->e2di_dacl = bswap32(old->e2di_dacl);
115 new->e2di_faddr = bswap32(old->e2di_faddr); 116 new->e2di_faddr = bswap32(old->e2di_faddr);
 117 new->e2di_nblock_high = bswap16(old->e2di_nblock_high);
 118 new->e2di_facl_high = bswap16(old->e2di_facl_high);
116 new->e2di_uid_high = bswap16(old->e2di_uid_high); 119 new->e2di_uid_high = bswap16(old->e2di_uid_high);
117 new->e2di_gid_high = bswap16(old->e2di_gid_high); 120 new->e2di_gid_high = bswap16(old->e2di_gid_high);
118 memcpy(&new->e2di_blocks[0], &old->e2di_blocks[0], 121 memcpy(&new->e2di_blocks[0], &old->e2di_blocks[0],
119 (NDADDR + NIADDR) * sizeof(uint32_t)); 122 (NDADDR + NIADDR) * sizeof(uint32_t));
120} 123}
121#endif 124#endif

cvs diff -r1.23 -r1.24 src/sys/ufs/ext2fs/ext2fs_dinode.h (expand / switch to unified diff)

--- src/sys/ufs/ext2fs/ext2fs_dinode.h 2012/11/18 18:20:56 1.23
+++ src/sys/ufs/ext2fs/ext2fs_dinode.h 2012/11/19 00:36:21 1.24
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ext2fs_dinode.h,v 1.23 2012/11/18 18:20:56 jakllsch Exp $ */ 1/* $NetBSD: ext2fs_dinode.h,v 1.24 2012/11/19 00:36:21 jakllsch Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1982, 1989, 1993 4 * Copyright (c) 1982, 1989, 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * (c) UNIX System Laboratories, Inc. 6 * (c) UNIX System Laboratories, Inc.
7 * All or some portions of this file are derived from material licensed 7 * All or some portions of this file are derived from material licensed
8 * to the University of California by American Telephone and Telegraph 8 * to the University of California by American Telephone and Telegraph
9 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 9 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
10 * the permission of UNIX System Laboratories, Inc. 10 * the permission of UNIX System Laboratories, Inc.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions 13 * modification, are permitted provided that the following conditions
14 * are met: 14 * are met:
@@ -99,35 +99,34 @@ @@ -99,35 +99,34 @@
99 99
100struct ext2fs_dinode { 100struct ext2fs_dinode {
101 uint16_t e2di_mode; /* 0: IFMT, permissions; see below. */ 101 uint16_t e2di_mode; /* 0: IFMT, permissions; see below. */
102 uint16_t e2di_uid; /* 2: Owner UID */ 102 uint16_t e2di_uid; /* 2: Owner UID */
103 uint32_t e2di_size; /* 4: Size (in bytes) */ 103 uint32_t e2di_size; /* 4: Size (in bytes) */
104 uint32_t e2di_atime; /* 8: Access time */ 104 uint32_t e2di_atime; /* 8: Access time */
105 uint32_t e2di_ctime; /* 12: Create time */ 105 uint32_t e2di_ctime; /* 12: Create time */
106 uint32_t e2di_mtime; /* 16: Modification time */ 106 uint32_t e2di_mtime; /* 16: Modification time */
107 uint32_t e2di_dtime; /* 20: Deletion time */ 107 uint32_t e2di_dtime; /* 20: Deletion time */
108 uint16_t e2di_gid; /* 24: Owner GID */ 108 uint16_t e2di_gid; /* 24: Owner GID */
109 uint16_t e2di_nlink; /* 26: File link count */ 109 uint16_t e2di_nlink; /* 26: File link count */
110 uint32_t e2di_nblock; /* 28: Blocks count */ 110 uint32_t e2di_nblock; /* 28: Blocks count */
111 uint32_t e2di_flags; /* 32: Status flags (chflags) */ 111 uint32_t e2di_flags; /* 32: Status flags (chflags) */
112 uint32_t e2di_linux_reserved1; /* 36 */ 112 uint32_t e2di_version; /* 36: was reserved1 */
113 uint32_t e2di_blocks[NDADDR+NIADDR]; /* 40: disk blocks */ 113 uint32_t e2di_blocks[NDADDR+NIADDR]; /* 40: disk blocks */
114 uint32_t e2di_gen; /* 100: generation number */ 114 uint32_t e2di_gen; /* 100: generation number */
115 uint32_t e2di_facl; /* 104: file ACL (not implemented) */ 115 uint32_t e2di_facl; /* 104: file ACL (not implemented) */
116 uint32_t e2di_dacl; /* 108: dir ACL (not implemented) */ 116 uint32_t e2di_dacl; /* 108: dir ACL (not implemented) */
117 uint32_t e2di_faddr; /* 112: fragment address */ 117 uint32_t e2di_faddr; /* 112: fragment address */
118 uint8_t e2di_nfrag; /* 116: fragment number */ 118 uint16_t e2di_nblock_high; /* 116: Blocks count bits 47:32 */
119 uint8_t e2di_fsize; /* 117: fragment size */ 119 uint16_t e2di_facl_high; /* 118: file ACL bits 47:32 */
120 uint16_t e2di_linux_reserved2; /* 118 */ 
121 uint16_t e2di_uid_high; /* 120: Owner UID top 16 bits */ 120 uint16_t e2di_uid_high; /* 120: Owner UID top 16 bits */
122 uint16_t e2di_gid_high; /* 122: Owner GID top 16 bits */ 121 uint16_t e2di_gid_high; /* 122: Owner GID top 16 bits */
123 uint32_t e2di_linux_reserved3; /* 124 */ 122 uint32_t e2di_linux_reserved3; /* 124 */
124}; 123};
125 124
126 125
127 126
128#define E2MAXSYMLINKLEN ((NDADDR + NIADDR) * sizeof(uint32_t)) 127#define E2MAXSYMLINKLEN ((NDADDR + NIADDR) * sizeof(uint32_t))
129 128
130/* File permissions. */ 129/* File permissions. */
131#define EXT2_IEXEC 0000100 /* Executable. */ 130#define EXT2_IEXEC 0000100 /* Executable. */
132#define EXT2_IWRITE 0000200 /* Writable. */ 131#define EXT2_IWRITE 0000200 /* Writable. */
133#define EXT2_IREAD 0000400 /* Readable. */ 132#define EXT2_IREAD 0000400 /* Readable. */

cvs diff -r1.63 -r1.64 src/sys/ufs/ufs/inode.h (expand / switch to unified diff)

--- src/sys/ufs/ufs/inode.h 2012/11/19 00:25:29 1.63
+++ src/sys/ufs/ufs/inode.h 2012/11/19 00:36:21 1.64
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: inode.h,v 1.63 2012/11/19 00:25:29 jakllsch Exp $ */ 1/* $NetBSD: inode.h,v 1.64 2012/11/19 00:36:21 jakllsch Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1982, 1989, 1993 4 * Copyright (c) 1982, 1989, 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * (c) UNIX System Laboratories, Inc. 6 * (c) UNIX System Laboratories, Inc.
7 * All or some portions of this file are derived from material licensed 7 * All or some portions of this file are derived from material licensed
8 * to the University of California by American Telephone and Telegraph 8 * to the University of California by American Telephone and Telegraph
9 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 9 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
10 * the permission of UNIX System Laboratories, Inc. 10 * the permission of UNIX System Laboratories, Inc.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions 13 * modification, are permitted provided that the following conditions
14 * are met: 14 * are met:
@@ -210,34 +210,35 @@ struct inode { @@ -210,34 +210,35 @@ struct inode {
210#define i_ffs2_extb i_din.ffs2_din->di_extb 210#define i_ffs2_extb i_din.ffs2_din->di_extb
211 211
212#define i_e2fs_mode i_din.e2fs_din->e2di_mode 212#define i_e2fs_mode i_din.e2fs_din->e2di_mode
213#define i_e2fs_uid i_din.e2fs_din->e2di_uid 213#define i_e2fs_uid i_din.e2fs_din->e2di_uid
214#define i_e2fs_size i_din.e2fs_din->e2di_size 214#define i_e2fs_size i_din.e2fs_din->e2di_size
215#define i_e2fs_atime i_din.e2fs_din->e2di_atime 215#define i_e2fs_atime i_din.e2fs_din->e2di_atime
216#define i_e2fs_ctime i_din.e2fs_din->e2di_ctime 216#define i_e2fs_ctime i_din.e2fs_din->e2di_ctime
217#define i_e2fs_mtime i_din.e2fs_din->e2di_mtime 217#define i_e2fs_mtime i_din.e2fs_din->e2di_mtime
218#define i_e2fs_dtime i_din.e2fs_din->e2di_dtime 218#define i_e2fs_dtime i_din.e2fs_din->e2di_dtime
219#define i_e2fs_gid i_din.e2fs_din->e2di_gid 219#define i_e2fs_gid i_din.e2fs_din->e2di_gid
220#define i_e2fs_nlink i_din.e2fs_din->e2di_nlink 220#define i_e2fs_nlink i_din.e2fs_din->e2di_nlink
221#define i_e2fs_nblock i_din.e2fs_din->e2di_nblock 221#define i_e2fs_nblock i_din.e2fs_din->e2di_nblock
222#define i_e2fs_flags i_din.e2fs_din->e2di_flags 222#define i_e2fs_flags i_din.e2fs_din->e2di_flags
 223#define i_e2fs_version i_din.e2fs_din->e2di_version
223#define i_e2fs_blocks i_din.e2fs_din->e2di_blocks 224#define i_e2fs_blocks i_din.e2fs_din->e2di_blocks
224#define i_e2fs_rdev i_din.e2fs_din->e2di_rdev 225#define i_e2fs_rdev i_din.e2fs_din->e2di_rdev
225#define i_e2fs_gen i_din.e2fs_din->e2di_gen 226#define i_e2fs_gen i_din.e2fs_din->e2di_gen
226#define i_e2fs_facl i_din.e2fs_din->e2di_facl 227#define i_e2fs_facl i_din.e2fs_din->e2di_facl
227#define i_e2fs_dacl i_din.e2fs_din->e2di_dacl 228#define i_e2fs_dacl i_din.e2fs_din->e2di_dacl
228#define i_e2fs_faddr i_din.e2fs_din->e2di_faddr 229#define i_e2fs_faddr i_din.e2fs_din->e2di_faddr
229#define i_e2fs_nfrag i_din.e2fs_din->e2di_nfrag 230#define i_e2fs_nblock_high i_din.e2fs_din->e2di_nblock_high
230#define i_e2fs_fsize i_din.e2fs_din->e2di_fsize 231#define i_e2fs_facl_high i_din.e2fs_din->e2di_facl_high
231#define i_e2fs_uid_high i_din.e2fs_din->e2di_uid_high 232#define i_e2fs_uid_high i_din.e2fs_din->e2di_uid_high
232#define i_e2fs_gid_high i_din.e2fs_din->e2di_gid_high 233#define i_e2fs_gid_high i_din.e2fs_din->e2di_gid_high
233 234
234/* These flags are kept in i_flag. */ 235/* These flags are kept in i_flag. */
235#define IN_ACCESS 0x0001 /* Access time update request. */ 236#define IN_ACCESS 0x0001 /* Access time update request. */
236#define IN_CHANGE 0x0002 /* Inode change time update request. */ 237#define IN_CHANGE 0x0002 /* Inode change time update request. */
237#define IN_UPDATE 0x0004 /* Inode was written to; update mtime. */ 238#define IN_UPDATE 0x0004 /* Inode was written to; update mtime. */
238#define IN_MODIFY 0x2000 /* Modification time update request. */ 239#define IN_MODIFY 0x2000 /* Modification time update request. */
239#define IN_MODIFIED 0x0008 /* Inode has been modified. */ 240#define IN_MODIFIED 0x0008 /* Inode has been modified. */
240#define IN_ACCESSED 0x0010 /* Inode has been accessed. */ 241#define IN_ACCESSED 0x0010 /* Inode has been accessed. */
241/* #define IN_UNUSED 0x0020 */ /* unused, was IN_RENAME */ 242/* #define IN_UNUSED 0x0020 */ /* unused, was IN_RENAME */
242#define IN_SHLOCK 0x0040 /* File has shared lock. */ 243#define IN_SHLOCK 0x0040 /* File has shared lock. */
243#define IN_EXLOCK 0x0080 /* File has exclusive lock. */ 244#define IN_EXLOCK 0x0080 /* File has exclusive lock. */