2 * Copyright (c) International Business Machines Corp., 2001-2004
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
12 * the GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 #include <sys/types.h>
37 void metaops_metadir(ffsb_fs_t *fs, unsigned opnum)
39 fs_set_opdata(fs, fs_get_metafiles(fs), opnum);
42 static void createdir(struct benchfiles *dirs, randdata_t *rd)
44 struct ffsb_file *newdir;
46 newdir = add_file(dirs, 0, rd);
47 if (mkdir(newdir->name, S_IRWXU) < 0) {
51 unlock_file_writer(newdir);
54 static void removedir(struct benchfiles *dirs, randdata_t *rd)
56 struct ffsb_file *deldir;
58 deldir = choose_file_writer(dirs, rd);
59 remove_file(dirs, deldir);
61 if (rmdir(deldir->name) < 0) {
65 unlock_file_writer(deldir);
68 static void renamedir(struct benchfiles *dirs, randdata_t *rd)
70 struct ffsb_file *dir;
73 dir = choose_file_writer(dirs, rd);
77 if (rename(oldname, dir->name) < 0) {
81 unlock_file_writer(dir);
85 void ffsb_metaops(ffsb_thread_t *ft, ffsb_fs_t *fs, unsigned opnum)
87 struct benchfiles *bf = (struct benchfiles *)fs_get_opdata(fs, opnum);
88 randdata_t *rd = ft_get_randdata(ft);
95 ft_incr_op(ft, opnum, 1, 0);
98 void ffsb_createdir(ffsb_thread_t *ft, ffsb_fs_t *fs, unsigned opnum)
100 struct benchfiles *bf = (struct benchfiles *)fs_get_opdata(fs, opnum);
101 struct ffsb_file *newdir;
102 randdata_t *rd = ft_get_randdata(ft);
104 newdir = add_dir(bf, 0, rd);
105 if (mkdir(newdir->name, S_IRWXU) < 0) {
109 unlock_file_writer(newdir);
111 ft_incr_op(ft, opnum, 1, 0);