~ubuntu-branches/ubuntu/karmic/openafs/karmic-updates

« back to all changes in this revision

Viewing changes to src/afs/DARWIN/osi_file.c

  • Committer: Bazaar Package Importer
  • Author(s): Russ Allbery
  • Date: 2008-09-22 19:07:02 UTC
  • mfrom: (12.1.14 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080922190702-59m13d7kn6gkw32d
Tags: 1.4.7.dfsg1-6
* Apply upstream patch to free /proc entries in the correct order.
  Thanks, Marc Dionne.  (Closes: #493914)
* Apply upstream deltas to support 2.6.27 kernels and to stop using
  COMMON_KERN_CFLAGS for all 2.6 kernels uniformly, which fixes
  problems on amd64 with newer kernels.  Thanks, Björn Torkelsson.
  (LP: #267504)
* Translation updates:
  - Swedish, thanks Martin Bagge.  (Closes: #493120)

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
#include "afs/param.h"
12
12
 
13
13
RCSID
14
 
    ("$Header: /cvs/openafs/src/afs/DARWIN/osi_file.c,v 1.8.2.5 2006/08/20 22:16:47 shadow Exp $");
 
14
    ("$Header: /cvs/openafs/src/afs/DARWIN/osi_file.c,v 1.8.2.8 2007/12/13 19:18:49 shadow Exp $");
15
15
 
16
16
#include "afs/sysincludes.h"    /* Standard vendor system headers */
17
17
#include "afsincludes.h"        /* Afs-based standard headers */
141
141
    extern int cacheDiskType;
142
142
    afs_int32 code = 0;
143
143
    int dummy;
 
144
    char fname[1024];
 
145
    struct osi_stat tstat;
 
146
 
144
147
    AFS_STATCNT(osi_UFSOpen);
145
148
    if (cacheDiskType != AFS_FCACHE_TYPE_UFS) {
146
149
        osi_Panic("UFSOpen called for non-UFS cache\n");
154
157
    }
155
158
    afile = (struct osi_file *)osi_AllocSmallSpace(sizeof(struct osi_file));
156
159
    AFS_GUNLOCK();
 
160
#ifdef AFS_CACHE_VNODE_PATH
 
161
    if (ainode < 0) {
 
162
        switch (ainode) {
 
163
        case AFS_CACHE_CELLS_INODE:
 
164
            snprintf(fname, 1024, "%s/%s", afs_cachebasedir, "CellItems");
 
165
            break;
 
166
        case AFS_CACHE_ITEMS_INODE:
 
167
            snprintf(fname, 1024, "%s/%s", afs_cachebasedir, "CacheItems");
 
168
            break;
 
169
        case AFS_CACHE_VOLUME_INODE:
 
170
            snprintf(fname, 1024, "%s/%s", afs_cachebasedir, "VolumeItems");
 
171
            break;
 
172
        default:
 
173
            osi_Panic("Invalid negative inode");
 
174
        }
 
175
    } else {
 
176
        dummy = ainode / afs_numfilesperdir;
 
177
        snprintf(fname, 1024, "%s/D%d/V%d", afs_cachebasedir, dummy, ainode);
 
178
    }
 
179
 
 
180
    code = vnode_open(fname, O_RDWR, 0, 0, &vp, afs_osi_ctxtp);
 
181
#else
157
182
#ifndef AFS_DARWIN80_ENV
158
183
    if (afs_CacheFSType == AFS_APPL_HFS_CACHE)
159
184
        code = igetinode(afs_cacheVfsp, (dev_t) cacheDev.dev, &ainode, &vp, &va, &dummy);       /* XXX hfs is broken */
166
191
    else
167
192
        panic("osi_UFSOpen called before cacheops initialized\n");
168
193
#endif
 
194
#endif
169
195
    AFS_GLOCK();
170
196
    if (code) {
171
197
        osi_FreeSmallSpace(afile);
172
198
        osi_Panic("UFSOpen: igetinode failed");
173
199
    }
174
200
    afile->vnode = vp;
175
 
    afile->size = va.va_size;
176
201
    afile->offset = 0;
177
202
    afile->proc = (int (*)())0;
178
203
    afile->inum = ainode;       /* for hint validity checking */
 
204
#ifndef AFS_CACHE_VNODE_PATH
 
205
    afile->size = va.va_size;
 
206
#else
 
207
    code = afs_osi_Stat(afile, &tstat);
 
208
    afile->size = tstat.size;
 
209
#endif
179
210
    return (void *)afile;
180
211
}
181
212
 
202
233
    AFS_GLOCK();
203
234
    if (code == 0) {
204
235
        astat->size = tvattr.va_size;
205
 
        astat->blksize = tvattr.va_blocksize;
206
236
        astat->mtime = tvattr.va_mtime.tv_sec;
207
237
        astat->atime = tvattr.va_atime.tv_sec;
208
238
    }
388
418
void
389
419
shutdown_osifile(void)
390
420
{
391
 
    extern int afs_cold_shutdown;
392
 
 
393
421
    AFS_STATCNT(shutdown_osifile);
394
422
    if (afs_cold_shutdown) {
395
423
        afs_osicred_initialized = 0;