Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

init_tgt isn't always necessary #80

Open
mattysweeps opened this issue Jan 14, 2025 · 1 comment
Open

init_tgt isn't always necessary #80

mattysweeps opened this issue Jan 14, 2025 · 1 comment

Comments

@mattysweeps
Copy link
Contributor

__ublksrv_tgt_init which is invoked from ublksrv_dev_init checks:

if (!ops->init_tgt)
	return -EINVAL;

In my use case I don't have any work to do here, so I define an empty function:

static int init_tgt(struct ublksrv_dev *dev, int type, int argc, char *argv[]) {
  return 0;
}

static struct ublksrv_tgt_type ops = {
...
    .init_tgt = init_tgt,
...
};

This works fine, but I'm curious if the requirement for init_tgt can be removed. The reason why I don't have anything to do here is I'm using ublksrv as a library (not integrating a new type into the ublk cli).

I thought I'd open this issue to learn more about why init_tgt was required. Thank you,

@mattysweeps mattysweeps changed the title init_tgt isn't always necesarry init_tgt isn't always necessary Jan 14, 2025
@ming1
Copy link
Collaborator

ming1 commented Jan 15, 2025

->init_tgt() is usually useful for initializing everything for setting up the target,
but it isn't a must.

I have relaxed the limit by commit cbe556e.

Thanks,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants