2
* Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
2
* Copyright (c) 2000-2001 Silicon Graphics, Inc. All Rights Reserved.
4
4
* This program is free software; you can redistribute it and/or modify it
5
5
* under the terms of version 2 of the GNU General Public License as
6
6
* published by the Free Software Foundation.
8
8
* This program is distributed in the hope that it would be useful, but
9
9
* WITHOUT ANY WARRANTY; without even the implied warranty of
10
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
12
* Further, this software is distributed without any warranty that it is
13
13
* free of the rightful claim of any third person regarding infringement
14
14
* or the like. Any license provided herein, whether implied or
15
15
* otherwise, applies only to this software file. Patent licenses, if
16
16
* any, provided herein do not apply to combinations of this program with
17
17
* other software, or any other product whatsoever.
19
19
* You should have received a copy of the GNU General Public License along
20
20
* with this program; if not, write the Free Software Foundation, Inc., 59
21
21
* Temple Place - Suite 330, Boston MA 02111-1307, USA.
23
23
* Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24
24
* Mountain View, CA 94043, or:
28
* For further information regarding this notice, see:
28
* For further information regarding this notice, see:
30
30
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
53
53
mp->m_dirdatablk = XFS_DIR2_DB_TO_DA(mp, XFS_DIR2_DATA_FIRSTDB(mp));
54
54
mp->m_dirleafblk = XFS_DIR2_DB_TO_DA(mp, XFS_DIR2_LEAF_FIRSTDB(mp));
55
55
mp->m_dirfreeblk = XFS_DIR2_DB_TO_DA(mp, XFS_DIR2_FREE_FIRSTDB(mp));
56
mp->m_attr_node_ents =
57
(mp->m_sb.sb_blocksize - (uint)sizeof(xfs_da_node_hdr_t)) /
58
(uint)sizeof(xfs_da_node_entry_t);
57
60
(mp->m_dirblksize - (uint)sizeof(xfs_da_node_hdr_t)) /
58
61
(uint)sizeof(xfs_da_node_entry_t);
59
62
mp->m_dir_magicpct = (mp->m_dirblksize * 37) / 100;
71
74
xfs_da_args_t args; /* operation arguments */
72
75
int error; /* error return value */
74
bzero((char *)&args, sizeof(args));
77
memset((char *)&args, 0, sizeof(args));
77
ASSERT((dp->i_d.di_mode & IFMT) == IFDIR);
80
ASSERT((dp->i_d.di_mode & S_IFMT) == S_IFDIR);
78
81
if ((error = xfs_dir_ino_validate(tp->t_mountp, pdp->i_ino))) {
99
102
int rval; /* return value */
100
103
int v; /* type-checking value */
102
ASSERT((dp->i_d.di_mode & IFMT) == IFDIR);
105
ASSERT((dp->i_d.di_mode & S_IFMT) == S_IFDIR);
103
106
if ((rval = xfs_dir_ino_validate(tp->t_mountp, inum))) {
106
XFS_STATS_INC(xfsstats.xs_dir_create);
109
XFS_STATS_INC(xs_dir_create);
108
111
* Fill in the arg structure for this request.
152
155
int rval; /* return value */
153
156
int v; /* type-checking value */
155
ASSERT((dp->i_d.di_mode & IFMT) == IFDIR);
156
if (namelen >= MAXNAMELEN) {
157
return XFS_ERROR(EINVAL);
159
XFS_STATS_INC(xfsstats.xs_dir_lookup);
158
ASSERT((dp->i_d.di_mode & S_IFMT) == S_IFDIR);
159
XFS_STATS_INC(xs_dir_lookup);
161
162
* Fill in the arg structure for this request.
212
213
int rval; /* return value */
213
214
int v; /* type-checking value */
215
ASSERT((dp->i_d.di_mode & IFMT) == IFDIR);
216
XFS_STATS_INC(xfsstats.xs_dir_remove);
216
ASSERT((dp->i_d.di_mode & S_IFMT) == S_IFDIR);
217
XFS_STATS_INC(xs_dir_remove);
218
219
* Fill in the arg structure for this request.
264
265
int rval; /* return value */
265
266
int v; /* type-checking value */
267
ASSERT((dp->i_d.di_mode & IFMT) == IFDIR);
268
if (namelen >= MAXNAMELEN) {
269
return XFS_ERROR(EINVAL);
268
ASSERT((dp->i_d.di_mode & S_IFMT) == S_IFDIR);
271
270
if ((rval = xfs_dir_ino_validate(tp->t_mountp, inum))) {
532
531
* and not binval it.
533
532
* So the block has to be in a consistent empty state
534
533
* and appropriately logged.
535
* We don't free up the buffer, the caller can tell it
534
* We don't free up the buffer, the caller can tell it
536
535
* hasn't happened since it got an error back.
546
545
* If it's not a data block, we're done.
548
if (db >= XFS_DIR2_LEAF_FIRSTDB(mp))
547
if (db >= XFS_DIR2_LEAF_FIRSTDB(mp))
551
550
* If the block isn't the last one in the directory, we're done.