-
-#if 0
-/* Assumes caller has already pushed us into the kernel context. */
-int llog_cat_init(struct llog_handle *cathandle, struct obd_uuid *tgtuuid)
-{
- struct llog_log_hdr *llh;
- loff_t offset = 0;
- int rc = 0;
- ENTRY;
-
- LASSERT(sizeof(*llh) == LLOG_CHUNK_SIZE);
-
- down(&cathandle->lgh_lock);
- llh = cathandle->lgh_hdr;
-
- if (i_size_read(cathandle->lgh_file->f_dentry->d_inode) == 0) {
- llog_write_rec(cathandle, &llh->llh_hdr, NULL, 0, NULL, 0);
-
-write_hdr:
- rc = lustre_fwrite(cathandle->lgh_file, llh, LLOG_CHUNK_SIZE,
- &offset);
- if (rc != LLOG_CHUNK_SIZE) {
- CERROR("error writing catalog header: rc %d\n", rc);
- OBD_FREE(llh, sizeof(*llh));
- if (rc >= 0)
- rc = -ENOSPC;
- } else
- rc = 0;
- } else {
- rc = lustre_fread(cathandle->lgh_file, llh, LLOG_CHUNK_SIZE,
- &offset);
- if (rc != LLOG_CHUNK_SIZE) {
- CERROR("error reading catalog header: rc %d\n", rc);
- /* Can we do much else if the header is bad? */
- goto write_hdr;
- } else
- rc = 0;
- }
-
- cathandle->lgh_tgtuuid = &llh->llh_tgtuuid;
- up(&cathandle->lgh_lock);
- RETURN(rc);
-}
-EXPORT_SYMBOL(llog_cat_init);
-
-#endif