salvager: Trust inode-based special data over OGM
[openafs.git] / src / vol / namei_ops.h
1 /*
2  * Copyright 2000, International Business Machines Corporation and others.
3  * All Rights Reserved.
4  *
5  * This software has been released under the terms of the IBM Public
6  * License.  For details, see the LICENSE file in the top-level source
7  * directory or online at http://www.openafs.org/dl/license10.html
8  */
9
10 /* User space file system operations for Unix platforms. */
11
12 #ifndef _AFS_NAMEI_OPS_H_H_
13 #define _AFS_NAMEI_OPS_H_H_
14
15 #ifdef AFS_NAMEI_ENV
16
17 /* Basic file operations */
18 extern FD_t namei_fdopen(IHandle_t * h, char *fdperms);
19 extern int namei_unlink(char *name);
20
21 /* Inode operations */
22 extern Inode namei_MakeSpecIno(int volid, int type);
23 extern Inode namei_icreate(IHandle_t * lh, char *part, afs_uint32 p1,
24                            afs_uint32 p2, afs_uint32 p3, afs_uint32 p4);
25 extern FD_t namei_iopen(IHandle_t * h);
26 extern int namei_irelease(IHandle_t * h);
27 afs_sfsize_t namei_iread(IHandle_t * h, afs_foff_t offset, char *buf,
28                          afs_fsize_t size);
29 afs_sfsize_t namei_iwrite(IHandle_t * h, afs_foff_t offset, char *buf,
30                           afs_fsize_t size);
31 extern int namei_dec(IHandle_t * h, Inode ino, int p1);
32 extern int namei_inc(IHandle_t * h, Inode ino, int p1);
33 extern int namei_GetLinkCount(FdHandle_t * h, Inode ino, int lockit, int fixup, int nowrite);
34 extern int namei_SetLinkCount(FdHandle_t * h, Inode ino, int count, int locked);
35 extern int namei_ViceREADME(char *partition);
36 extern int namei_FixSpecialOGM(FdHandle_t *h, int check);
37 #include "nfs.h"
38 #include "viceinode.h"
39 int namei_ListAFSFiles(char *dev,
40                        int (*write_fun) (FD_t fp,
41                                          struct ViceInodeInfo * info,
42                                          char *dir, char *file), FD_t fp,
43                        int (*judge_fun) (struct ViceInodeInfo * info,
44                                          afs_uint32 vid, void *rock),
45                        afs_uint32 singleVolumeNumber, void *rock);
46 int ListViceInodes(char *devname, char *mountedOn, FD_t inodeFile,
47                    int (*judgeInode) (struct ViceInodeInfo * info, afs_uint32 vid,
48                                       void *rock),
49                    afs_uint32 singleVolumeNumber, int *forcep, int forceR,
50                    char *wpath, void *rock);
51
52 #define NAMEI_LCOMP_LEN 32
53 #define NAMEI_PATH_LEN 256
54
55 #ifdef AFS_NT40_ENV
56 #define NAMEI_DRIVE_LEN 3
57 #define NAMEI_HASH_LEN 2
58 #define NAMEI_COMP_LEN 18
59 typedef struct {
60     char n_drive[NAMEI_DRIVE_LEN];
61     char n_voldir[NAMEI_COMP_LEN];
62     char n_dir[NAMEI_HASH_LEN];
63     char n_inode[NAMEI_COMP_LEN];
64     char n_path[NAMEI_PATH_LEN];
65 } namei_t;
66 #else
67 #define NAMEI_SCOMP_LEN 12
68 typedef struct {
69     char n_base[NAMEI_LCOMP_LEN];
70     char n_voldir1[NAMEI_SCOMP_LEN];
71     char n_voldir2[NAMEI_LCOMP_LEN];
72     char n_dir1[NAMEI_SCOMP_LEN];
73     char n_dir2[NAMEI_SCOMP_LEN];
74     char n_inode[NAMEI_LCOMP_LEN];
75     char n_path[NAMEI_PATH_LEN];
76 } namei_t;
77 #endif
78
79 void namei_HandleToName(namei_t * name, IHandle_t * h);
80 int namei_ConvertROtoRWvolume(char *pname, afs_uint32 volumeId);
81 int namei_replace_file_by_hardlink(IHandle_t *hLink, IHandle_t *hTarget);
82
83 # ifdef AFS_SALSRV_ENV
84 #  include <afs/work_queue.h>
85 extern void namei_SetWorkQueue(struct afs_work_queue *wq);
86 # endif
87
88 #endif /* AFS_NAMEI_ENV */
89
90 #endif /* _AFS_NAMEI_OPS_H_H_ */