* GPL HEADER END
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved
+ * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*/
/*
return count;
}
-static int mdc_changelog_seq_release(struct inode *inode, struct file *file)
-{
- struct seq_file *seq = file->private_data;
- struct changelog_seq_iter *csi = seq->private;
-
- if (csi && csi->csi_llh)
- llog_cat_put(csi->csi_llh);
- if (csi && csi->csi_ctxt)
- llog_ctxt_put(csi->csi_ctxt);
-
- return (changelog_seq_release(inode, file));
-}
-
-static int mdc_changelog_seq_open(struct inode *inode, struct file *file)
-{
- struct changelog_seq_iter *csi;
- int rc;
- ENTRY;
-
- rc = changelog_seq_open(inode, file, &csi);
- if (rc)
- RETURN(rc);
-
- /* Set up the remote catalog handle */
- /* Note the proc file is set up with obd in data, not mdc_device */
- csi->csi_ctxt = llog_get_context((struct obd_device *)csi->csi_dev,
- LLOG_CHANGELOG_REPL_CTXT);
- if (csi->csi_ctxt == NULL)
- GOTO(out, rc = -ENOENT);
- rc = llog_create(csi->csi_ctxt, &csi->csi_llh, NULL, CHANGELOG_CATALOG);
- if (rc) {
- CERROR("llog_create() failed %d\n", rc);
- GOTO(out, rc);
- }
- rc = llog_init_handle(csi->csi_llh, LLOG_F_IS_CAT, NULL);
- if (rc) {
- CERROR("llog_init_handle failed %d\n", rc);
- GOTO(out, rc);
- }
-
-out:
- if (rc)
- mdc_changelog_seq_release(inode, file);
- RETURN(rc);
-}
-
-static struct file_operations mdc_changelog_fops = {
- .owner = THIS_MODULE,
- .open = mdc_changelog_seq_open,
- .read = seq_read,
- .llseek = changelog_seq_lseek,
- .release = mdc_changelog_seq_release,
-};
-
/* temporary for testing */
-static int mdc_wr_netlink(struct file *file, const char *buffer,
- unsigned long count, void *data)
+static int mdc_wr_kuc(struct file *file, const char *buffer,
+ unsigned long count, void *data)
{
struct obd_device *obd = data;
- struct lnl_hdr *lh;
+ struct kuc_hdr *lh;
struct hsm_action_list *hal;
struct hsm_action_item *hai;
int len;
- int pid, rc;
+ int fd, rc;
- rc = lprocfs_write_helper(buffer, count, &pid);
+ rc = lprocfs_write_helper(buffer, count, &fd);
if (rc)
return rc;
- if (pid < 0)
+ if (fd < 0)
return -ERANGE;
- CWARN("message to pid %d\n", pid);
+ CWARN("message to fd %d\n", fd);
len = sizeof(*lh) + sizeof(*hal) + MTI_NAME_MAXLEN +
- /* for mockup below */ 2 * size_round(sizeof(*hai));
+ /* for mockup below */ 2 * cfs_size_round(sizeof(*hai));
OBD_ALLOC(lh, len);
- lh->lnl_magic = LNL_MAGIC;
- lh->lnl_transport = LNL_TRANSPORT_HSM;
- lh->lnl_msgtype = HMT_ACTION_LIST;
- lh->lnl_msglen = len;
+ lh->kuc_magic = KUC_MAGIC;
+ lh->kuc_transport = KUC_TRANSPORT_HSM;
+ lh->kuc_msgtype = HMT_ACTION_LIST;
+ lh->kuc_msglen = len;
hal = (struct hsm_action_list *)(lh + 1);
hal->hal_version = HAL_VERSION;
hai->hai_fid.f_oid = 10;
hai->hai_len = sizeof(*hai);
- /* This works for either broadcast or unicast to a single pid */
- rc = libcfs_klnl_msg_put(pid, pid == 0 ? LNL_GRP_HSM : 0, lh);
-
+ /* This works for either broadcast or unicast to a single fd */
+ if (fd == 0) {
+ rc = libcfs_kkuc_group_put(KUC_GRP_HSM, lh);
+ } else {
+ cfs_file_t *fp = cfs_get_fd(fd);
+ rc = libcfs_kkuc_msg_put(fp, lh);
+ cfs_put_file(fp);
+ }
OBD_FREE(lh, len);
if (rc < 0)
return rc;
{ "timeouts", lprocfs_rd_timeouts, 0, 0 },
{ "import", lprocfs_rd_import, 0, 0 },
{ "state", lprocfs_rd_state, 0, 0 },
- { "changelog", 0, 0, 0, &mdc_changelog_fops, 0400 },
- { "netlink", 0, mdc_wr_netlink, 0, 0, 0222 },
+ { "hsm_nl", 0, mdc_wr_kuc, 0, 0, 0222 },
{ 0 }
};